<html>

<head>
    <script>
        external.onmessage = function (m) {
            external.postMessage('send back: ' + m)
        };

        var first = true;
        external.onclose = function () {
            if (first) {
                first = false;
                external.postMessage('try close');
                return false;
            }
        }

        window.onerror = function (errMsg) {
            console.log('errMsg', errMsg)
        }

        console.log('test log')
        console.warn('test warn')
        console.info('test info')
        // console.notice('test notice')
        console.error('test error')
    </script>
</head>

<body>
    <div id="app">click button to load...</div>
    <button id="btn" onclick="updateAppContent()">load</button>
    <script type="text/javascript">
        function updateAppContent(n) {
            document.getElementById('app').innerText = 'test in test/gui_test.js';
            document.getElementById('btn').remove();
        }
    </script>
</body>

</html>